package find_code;

import java.util.ArrayList;


//基础查找
public class BasicSearchTest {
    public static void main(String[] args) {
        int[] arr = {1,5,80,23,43,43,54,6,76,3};
        int number = 43;
        ArrayList<Integer> list = basicSearch(arr,number);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }

    //考虑重复，返回查找数的索引
    public static ArrayList<Integer> basicSearch(int[] arr, int number){
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == number){
                list.add(i);
            }
        }
        return list;
    }
}


